<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="box">
        <!-- 元素定义了ref行内属性，ref属性可以在任意的元素上绑定 -->
        <input type="text" ref="myinput">
        <div ref="mycontainer">container</div>
        <button @click="handleClick">点击</button>
    </div>
    <script>
        //根组件
        var vm = new Vue({
            el: "#box",
            methods: {
                handleClick() {
                    //通过this.$refs属性可以获取页面中所有绑定ref行内属性的DOM对象
                    console.log(this.$refs)
                }
            }
        })
    </script>
</body>

</html>